{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import socket\n",
    "sk=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)\n",
    "\n",
    "sk.bind(('127.0.0.1',9090))\n",
    "while True:\n",
    "    data,addr=sk.recvfrom(1024)\n",
    "    rst='hello'\n",
    "    sk.sendto(rst,addr)\n",
    "    print(data)\n",
    "    print('server Done')\n",
    "    sk.close()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import socket\n",
    "sk=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)\n",
    "\n",
    "msg=b'17'\n",
    "addr=('127.0.0.1',9090)\n",
    "sk.sendto(msg,addr)\n",
    "rst=sk.recvfrom(1024)\n",
    "print(rst)\n",
    "print('client  Done')\n",
    "sk.close()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
